<include file="../Public/head" />
<!-- <link rel="stylesheet" href="/Public/Js/ZTree/zTreeStyle/zTreeStyle.css" type="text/css"> -->
<!-- <script type="text/javascript" src="/Public/Js/ZTree/jquery.ztree-2.6.min.js"></script> -->

<link rel="stylesheet" href="/Public/Js/ZTree/v3/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="/Public/Js/ZTree/v3/jquery.ztree.all-3.5.min.js"></script>

<script src="/Public/Js/artDialog/artDialog.js?skin=blue"></script>
<script src="/Public/Js/artDialog/plugins/iframeTools.js"></script>

<style type="text/css">
body {
	background-color: #fff;
}
h3 {
	margin: 8px;
}
</style>
<div style="clear:both;">
	<div style="float:left;width:300px">
		<h3>组织架构</h3>
		<ul id="tree_sort" class="ztree"></ul>					
	</div>
	<div style="float:left;min-width:400px">
		<h3>成员</h3>
		<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#BBD3EB" id="tb_list">
			<tr bgcolor="#F7FAFF">
				<td   align="center" background="../Public/images/index1_72.gif" bgcolor="#FFFFFF" class="bold">姓名</th>
				<td align="center" background="../Public/images/index1_72.gif" bgcolor="#FFFFFF" class="bold">账号</th>
				<td  align="center" background="../Public/images/index1_72.gif" bgcolor="#FFFFFF" class="bold">选择</th>
			</tr>
			<volist name="userlist" id="vo">
			<tr bgcolor="#FFF">
				<td height="26" >{$vo.name}</td>
				<td height="26">{$vo.userid}</td>
				<td height="26"><input type="button" value="选择" onclick="selected('{$vo.userid}','{$vo.name}')"></td>
				
			</tr>
			</volist>
		</table>		
	</div>
</div>
<script language="javascript">
<!--
var zTreeObj;
var setting = {
	isSimpleData : true,	
    treeNodeKey : "id",
    treeNodeParentKey : "pId",
    callback: {
		onClick: zTreeOnClick
	},
	data: {
		simpleData: {
			enable: true,
			idKey: "id",
			pIdKey: "pId",
			rootPId: 0
		}
	}
}; //zTree的参数配置）
var zNodes = [
<volist name="list" id="vo" key="k">

				{ id:{$vo.id},pId:{$vo.parentid},name:"{$vo.name}"}<if condition="$k neq $total" >,</if>				
</volist>			
			]; //zTree的数据属性解

function zTreeOnClick(event, treeId, treeNode) {
    // alert(treeNode.id + ", " + treeNode.name);
    // $.getJSON('__URL__/selectUserFromWx/act/getMember/deptId/'+treeNode.id,function(rt){
    // 	alert(rt.data);
    // 	console.log(rt.data);
    // });
location.href = '__URL__/selectUserFromWx/act/getMember/deptId/'+treeNode.id;
};

function selected(userid,name) {
	art.dialog.data('userInfo',{userId:userid,name:name});
	art.dialog.close();
}

$(document).ready(function(){

	setListStyle("tb_list");
	// zTreeObj = $("#tree_sort").zTree(setting, zNodes);
	zTreeObj = $.fn.zTree.init($("#tree_sort"), setting, zNodes);
	var depdId='<?php echo $_REQUEST["deptId"]; ?>';
	if(depdId) {
		var nodes = zTreeObj.getNodesByParam("id", depdId, null);
		zTreeObj.selectNode(nodes[0]);
		// zTreeObj.expandNode(nodes[0], true, true, true);
		console.log(nodes[0]);
	}
});
</script>

<!-- 主页面结束 -->
<!-- 加载尾部公共文件 -->
<include file="../Public/foot" />